[Linq to sql] query result what should i use Count() or Any()...
Posted
by Pandiya Chendur
on Stack Overflow
See other posts from Stack Overflow
or by Pandiya Chendur
Published on 2010-05-18T11:57:02Z
Indexed on
2010/05/18
12:20 UTC
Read the original article
Hit count: 126
I am checking login of a user by this repository method,
public bool getLoginStatus(string emailId, string password)
{
var query = from r in taxidb.Registrations
where (r.EmailId == emailId && r.Password==password)
select r;
if (query.Count() != 0)
{
return true;
}
return false;
}
I saw in one of the previous questions !query.Any()
would be faster... Which should i use? Any suggestion....
© Stack Overflow or respective owner